package com.atkxp.service;

import com.atkxp.pojo.Blog;
import com.atkxp.pojo.Page;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * @author user
 * @declaration
 * @create 2022/11/6-19:24
 */
public interface BlogService {
    List<Blog> getAllBlog();

    List<Blog> getAllBlogOrderByTime();

    Page<Blog> getBlogsLimit(int pageNum, int pageSize);

    Blog getBlogById(int id);

    Page<Blog> getBlogByUserId(Map map);

    Page<Blog> getBlogByUserIdOrderByTime(Map map);

    int addBlog(Blog blog);

    int updateBlog(Blog blog);

    int deleteBlogById(int id);

    Page<Blog> queryBlog(Map map);

    int addLikes(int id);

    int addBrowsesNum(int id);

    int deleteLikes(int id);

    Long getBlogCountLimitByUserId(int userId);

    Long getBlogCountLimitByBlogName(String blogName);

    Page<Blog> getBlogByTag(Map map);

    List<Blog> FindSimilarBlogByTag(Blog blog);

    Page<Blog> getHistoryBlogOrderByTime(Map map);

    int addHistoryBlog(int userId, int blogId, Date lastBrowse);

    int deleteHistoryBlog(int userId, int blogId);

    Date getHistoryBlogDate(int userId, int blogId);

    boolean isExistHistoryBlog(@Param("userId") int userId, @Param("blogId") int blogId);

    int updateHistoryBlog(int userId, int blogId, Date lastBrowse);

    Page<Blog> getCollectedBlogOrderByTime(Map map);

    int collectBlog(int userId, int blogId, Date collectTime);

    int deleteCollectedBlog(int userId, int blogId);

    boolean isCollected(int userId, int blogId);

    int getNumOfCollections(int blogId);
}
